package settings_api

import (
	"github.com/gin-gonic/gin"
	"gvb_server/global"
	"gvb_server/models/ctype"
	"gvb_server/models/res"
)

func (SettingsApi) SettingInfoView(c *gin.Context) {
	var v PathVariable
	if err := c.ShouldBindUri(&v); err != nil {
		res.FailCode(res.ArgumentError, c)
		return
	}
	value := v.Name
	switch value {
	case ctype.Email:
		res.OkWithData(global.Config.Email, c)
		return
	case ctype.Jwt:
		res.OkWithData(global.Config.Jwt, c)
		return
	case ctype.Mysql:
		res.OkWithData(global.Config.Mysql, c)
		return
	case ctype.SiteInfo:
		res.OkWithData(global.Config.SiteInfo, c)
		return
	case ctype.QiNiu:
		res.OkWithData(global.Config.QiNiu, c)
		return
	case ctype.QQ:
		res.OkWithData(global.Config.QQ, c)
		return
	default:
		res.OkWithMessage("没有这个配置", c)
		return
	}
}
